/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,2,3,1};
        for (int i = 0; i < arr.length; i++) {
            boolean flag = false;
            for (int j = arr.length - 1; j > i; j--) {
                if (arr[i] == arr[j]) {
                    flag = true;
                    break;
                }
            }
            if(!flag){
                System.out.println(arr[i]);
                break;
            }
        }
    }
}